<template>
	<view class="third-body">
	

		<view class="sub-content">
			<uni-list class="my-list" v-if="dataArr.length">
				<uni-list-item v-for="(data,dataIndex) in dataArr" :key="dataIndex" :title="data.AAC003"  :note="data.AAB069"  @click="gotoDetails(data)"></uni-list-item>
			</uni-list>
			<uni-load-more v-if="dataArr.length" :status="status" :contentText="contentTxt"></uni-load-more>
			<view v-if="!dataArr.length" style="padding:100upx 16upx;text-align: center;">
				<image src="../../static/image/order.png" mode="widthFix" style="width:180upx;"></image>
			</view>
		</view>
		
	</view>
</template>
<script>
	import uniPopup from "@/components/uni-popup/uni-popup.vue";
	import uniList from '@/components/uni-list/uni-list.vue'
	import uniListItem from '@/components/uni-list-item/uni-list-item.vue'
	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue'

	import uniTag from '@/components/uni-tag/uni-tag.vue';
	export default {
		components: {
			uniPopup,
			uniTag,
			uniList,
			uniListItem,
			uniLoadMore
		},
		data() {
			
			return {
				AAC002: "",
				AAC003: "",
				AAZ500: "",
				AKC803: "",
				AAE140: "",
				dataArr: [],
				dataIndex:0,
				pageIndex: 1,
				totalPage: 1,
				status: 'more',
			
				contentTxt: {
					contentdown: "查看更多",
					contentrefresh: "正在加载...",
					contentnomore: "没有更多",
				}
			}
		},

		methods: {
			
			loadMore(e) {
				if (this.pageIndex < this.totalPage) {
					this.pageIndex++;
					if (this.pageIndex > this.totalPage) {
						this.pageIndex = this.totalPage;
					}
					this.getData();

				}
			},
			getData() {
				this.status = 'loading';
				var self = this;
				console.log(this.pageIndex)
				var param = {
					AAC002: this.AAC002,
					AAC003: this.AAC003,
					AAZ500: this.AAZ500,
					AKC803: this.AKC803,
					AAE140: this.AAE140,
					PAGENUM: this.pageIndex,
					PAGESIZE: 10
				}
				this.$request('S1001', param, 'POST', function(res) {
					if (res.data.CODE == 0) {
						self.totalPage = res.data.PAGESIZECOUNT;
						self.dataArr = self.dataArr.concat(res.data.DATA);		
						if (self.pageIndex == self.totalPage) {
							self.status = 'noMore'
						} else {
							self.status = 'more'
						}
					}
				})
			},
			gotoDetails(item) {
				uni.setStorageSync('renyuanInfo', item);
				uni.navigateTo({
					url: '../renyuan/zg'
				});
			},
		},
		

		mounted() {
			this.getData();
		},
		onLoad(params) {
			var userInfo = uni.getStorageSync('userInfo');
			this.AAE140 = userInfo.AAE140;
			this.AAC002 = userInfo.AAC002;
			this.AAC003 = userInfo.AAC003;
			this.AAZ500 = userInfo.AAZ500;
			this.AKC803 = userInfo.AKC803;
			this.pageIndex = 1;
		}
	}
</script>
